-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hw4 #94
base: RMulyukov/main
Are you sure you want to change the base?
hw4 #94
Conversation
2ac2c34
to
ab25b39
Compare
app/app/Response.php
Outdated
|
||
private function initSuccess(): void | ||
{ | ||
header("HTTP/1.1 200 OK"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сайд эффект. Заголовок сразу выставится и потом мы не сможем поменять, что может привести к неожиданным проблемам.
private function initSuccess(): void | ||
{ | ||
header("HTTP/1.1 200 OK"); | ||
$this->message = 'OK'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зачем нам тут устанавливать внутреннее значения сообщения?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в задании написано
• если строка корректна, то пользователю возвращается ответ 200 OK, с информационным текстом, что всё хорошо;
• если строка некорректна, то пользователю возвращается ответ 400 Bad Request, с информационным текстом, что всё плохо.
$this->message
содержит этот информационный текст
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вопрос в том, что тут мы устанавливаем заголовок и записываем значение в message, чтобы потом его получить и напечатать. Не будет ли лучше сразу напечатать и всё?
No description provided.